package com.www.applyword.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.classic.adapter.BaseAdapterHelper;
import com.classic.adapter.CommonRecyclerAdapter;
import com.www.applyword.Constants.Constants;
import com.www.applyword.R;
import com.www.applyword.bean.ResumeBean;
import com.www.applyword.ui.my.EvaluationActivity;
import com.www.applyword.utils.Utils;

/**
 * author : huang
 * date   : 2019/10/21 0021 15:06
 * version: 1.0
 * @author Administrator
 */
public class EducationAdapter extends CommonRecyclerAdapter<ResumeBean.ResumeSchoolBean> {
    public EducationAdapter(Context context) {
        super(context, R.layout.item_list_school);
    }


    @Override
    public void onUpdate(BaseAdapterHelper helper, ResumeBean.ResumeSchoolBean item, int position) {
        helper.setText(R.id.tv_school_name,item.getResumeSchool_Name());
        helper.setText(R.id.tv_school_domain,item.getResumeSchool_Major());
        helper.setText(R.id.tv_school_start_time,item.getResumeSchool_StartTime().split(" ")[0]);
        helper.setText(R.id.tv_school_time,item.getResumeSchool_Experience());
        if (Constants.type == 2){
            helper.getView(R.id.ib_edit).setVisibility(View.GONE);
        }else {
            helper.getView(R.id.ib_edit).setVisibility(View.VISIBLE);
        }
        helper.getView(R.id.ib_edit).setOnClickListener(v -> {
            Utils.getContext().startActivity(new Intent(Utils.getContext(), EvaluationActivity.class)
                    .putExtra("evaluationBean", item).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
        });
    }
}

